<?php

namespace module\index\validate;

use app\Validate;

class Coupon extends Validate
{
    /**
     * 所有验证场景需要的字段.
     *
     * @var array<array>
     */
    protected $scene = [
        'save' => ['coupon_id'],
        'index' => ['page', 'pageSize'],
    ];
    /**
     * Get the validation rules that apply to the request.
     *
     * @var array<string>
     */
    protected $rule = [
        'coupon_id' => 'require|integer|exists:app\model\Coupon,id',  // 优惠券ID
        'page' => 'integer|>:0',
        'pageSize' => 'integer|>:0',
    ];
    /**
     * 验证字段描述
     * 
     * @var array<string>
     */
    protected $field = [
        'coupon_id' => '优惠券',
        'page' => '页码',
        'pageSize' => '分页大小',
    ];
}

